﻿
$(document).ready(function(){
    $("#btnLogin").click(function(){
	    if ($("#txtUserName").val().length == 0) {
		    alert('用户名不能为空');
		    return false;
	    }
	    
	    $.ajax({
		    type:"POST",
            url:"ajaxLogin.aspx",
            data:"action=login&username="+$("#txtUserName").val()+"&psw="+$("#txtPsw").val(),
            success: function(msg){
                if(msg=="TRUE"){
                    location.href='Default.aspx';
                }else{
                    jAlert('warning',msg, 'Warning Dialog');
		        }
	        },
	        error:function(msg){
	            jAlert('error', msg, 'Error Dialog');
	        }
	    });
    });
});